package com.feri.fc.admin.listener;

import com.feri.fc.config.RocketMQConfig;
import com.feri.fc.dao.ServeDao;
import com.feri.fc.entity.Serve;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 千锋Java,为你而生！
 *
 * @Author: Feri
 * @Date:2024/11/27 14:17
 * @Modified:
 */
@Component
@RocketMQMessageListener(topic = RocketMQConfig.TOPIC_SERVES,consumerGroup = "servesync")
@Slf4j
public class ServeListener implements RocketMQListener<Serve> {
    @Resource
    private ServeDao dao;

    @Override
    public void onMessage(Serve serve) {
        log.info("开始处理，医院陪诊服务数据同步");
        dao.updateById(serve);
        log.info("结束处理，医院陪诊服务数据同步");
    }
}
